<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<script type="text/javascript">
		$(function(){
			var obj  = $("#ta").datagrid("getSelections");
			$("#editUser").form("load",{
				userid:obj[0].userid,
				username:obj[0].username,
				userpwd:obj[0].userpwd,
				roleid:obj[0].roleid	
			})
		});
		
		function subform(){
			$.post("user/updateUser",$("#editUser").serialize(),function(data){
				if(data.state == 200){
					$.messager.alert('提示','添加成功');
					$("#editUser").form("reset");
					$("#e").window("close");
					$("#ta").datagrid("reload");
				}else{
					$.messager.alert('提示','添加失败');
				}
			});
		}
		function closeForm(){
			$("#e").window("close");
		}
	</script>
<div align="center">
	<form id="editUser">
		<table align="center" style="margin-top:50px">
		     <tr >
				
				<td colspan="2">
					<input  type="hidden" name="userid">
				</td>
			</tr>
			<tr >
				<td>用户名:</td>
				<td>
					<input class="easyui-textbox" type="text" name="username" data-options="required:true">
				</td>
			</tr>
			<tr>
				<td>用户密码:</td>
				<td>
					<input class="easyui-textbox" type="text" name="userpwd" data-options="required:true">
				</td>
			</tr>
			<tr>
				<td>职&nbsp;&nbsp;&nbsp;位:</td>
				<td>
					<select id="cc" class="easyui-combobox" name="roleid" style="width:145px;">   
		    						<option value="0">员工</option>
								    <option value="1">收银员</option>   
								    <option value="2">仓库管理员</option>   
					</select>
				</td>
			</tr>
			<tr>
				<td colspan="2" >
					  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					  <a href="javascript:void(0)" class="easyui-linkbutton" onclick="subform()" data-options="iconCls:'icon-add'">提交</a>
					  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	                  <a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeForm()" data-options="iconCls:'icon-redo'">取消</a>
				</td>
				
			</tr>
		</table>
	</form>
	<!-- <form id="editUser">
			<div id="p" class="easyui-panel" title="My Panel"     
	        style="width:400px;height:200px;padding:10px;background:#fafafa;"   
	        data-options="iconCls:'icon-save',closable:true,    
	                collapsible:true,minimizable:true,maximizable:true" align="center" top="20">   
		    用户名：<input class="easyui-textbox" type="text" name="username" data-options="required:true"><br /><br />
		    密&nbsp;&nbsp;&nbsp;码：<input class="easyui-textbox" type="password" name="userpwd" data-options="required:true"><br /><br />
		    角&nbsp;&nbsp;&nbsp;色：<select id="cc" class="easyui-combobox" name="roleid" style="width:145px;">   
		    						<option value="0">员工</option>
								    <option value="1">收银员</option>   
								    <option value="2">仓库管理员</option>   
					  			</select><br /><br />
		    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="contentPage.submitForm()" data-options="iconCls:'icon-add'">提交</a>
		    	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="contentPage.clearForm()" data-options="iconCls:'icon-redo'">重置</a>
				<br /><br />
			</div>
	</form> -->
	</div>